export const getParseText = (html: string) => {
  const reg = /<(.+?)>(.*?)<\/.+?>/g;
  let flag = false;
  const msg = html.replace(reg, (all, tag, con) => {
    if (tag === 'strong') {
      return con;
    }
    const res = con.replace(/<.+?>/g, '');
    flag = true;
    return `<p>${res}</p>`;
  });
  if (flag) {
    return msg;
  }
  const res = msg.replace(/<.+?>/g, '');
  return res;
};

/**
 * 提取富文本中的文本
 */
export function handleGetText(html: string) {
  const reg = /<.+?>(.*?)<\/.+?>/g;
  const msg = html.replace(reg, (all, con) => {
    return getParseText(con);
  });
  const res = msg.replace(/<.+?>/g, '<p>');
  return res;
}
